package com.zero.guava.samples.FutureCallback;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;

public class FutureCallbackImpl2 implements FutureCallback<String> {

    final SettableFuture<String> future = SettableFuture.create();

    @Override
    public void onSuccess(String result) {
        future.set("successfully");
    }

    @Override
    public void onFailure(Throwable t) {
        future.setException(t);
    }

    public ListenableFuture<String> getCallbackResult() {
        return future;
    }
}
